package com.ceba.test.modules.admin.dao;


import abc.ID;
import abc.data.SqlSessionManager;
import abc.data.store.IStore;
import abc.data.store.StoreManager;
import abc.object.XObject;
import com.ceba.base.web.dao.IBaseDao;

public class BackupDao extends IBaseDao {

	public boolean add(String sqlPath,String sysZipPath){
		IStore store = StoreManager.create("g_backup");
		XObject object = new XObject("ID", ID.getGuid());
		object.put("DATABASE_PATH", sqlPath);
		object.put("FILE_PATH", sysZipPath);
		object.setCreateTime();
		object.setCreateUser();
		if (store.insert(object) > 0) {
			return true;
		}
		return false;
	}
	
	public boolean backup(String backupPath){
		return SqlSessionManager.backup(backupPath);
	}
	
	public boolean restore(String filePath){
		return SqlSessionManager.restore(filePath);
	}
}
